<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="lib/react.development.js"></script>
    <script src="lib/react-dom.development.js"></script>
    <script src="lib/babel.min.js"></script>
</head>
<body>
    <div id="root"></div>
    <script type="text/babel">
    let {Component} = React

    class Parent extends Component{
        constructor(){
            super();
            this.state = {
                msg:'这是父级数据'
            }
        }
        render(){


            return(
                <div>
                    <h2>父{this.state.msg}</h2>
                    <Child msg={this.state.msg}>
                    </Child>
                </div>
            )
        }
    }


    class Child extends Component{
        constructor(props){
            super();
            console.log(props)
            this.state = {
                msg:props.msg
            }
        }
        render(){
            return(
                <div>
                    <p>子{this.state.msg}</p>
                </div>
            )
        }
    }





    ReactDOM.render(
        <Parent />,
        document.querySelector("#root")
    )

    </script>
</body>
</html>